<?php
// +----------------------------------------------------------------------
// | NewThink [ Think More,Think Better! ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2018 http://www.newthink.cc All rights reserved.
// +----------------------------------------------------------------------
// | 版权所有：山西创泰网络科技有限公司
// +----------------------------------------------------------------------
// | Author: JiYun Date:2019-05-08 Time:18:12
// +----------------------------------------------------------------------

namespace app\common\service\system;

use app\common\service\BaseService;
use app\common\model\system\SystemUserLoginLog as SystemUserLoginLogModel;

/**
 * Class SystemUserLoginLog
 * @author JiYun On 2019/05/09
 * @package app\common\service\system
 */
final class SystemUserLoginLog extends BaseService
{
    public function __construct()
    {
        parent::__construct();
    }
    
    /**
     * 登录日志的写入
     * @author JiYun On 2019/05/09
     * @param string $userId
     * @param string $username
     * @param string $ip
     */
    public function saveLog($userId = '', $username = '', $ip = '')
    {
        $logData = [
            'login_user_id' => $userId,
            'username'      => $username,
            'ip'            => $ip,
            'login_time'    => date('Y/m/d H:i:s', time())
        ];
        
        $loginLog = new SystemUserLoginLogModel();
        $loginLog->saveLog($logData);
    }
}
